<template>
  <div>
    <el-card shadow="never">
      <el-skeleton :loading="loading" animated>
        <el-row :gutter="16" justify="space-between">
          <el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
            <div class="flex items-center">
              <el-avatar :src="avatar" :size="70" class="mr-16px">
                <img src="@/assets/imgs/avatar.gif" alt="" />
              </el-avatar>
              <div>
                <div class="text-20px">
                  {{ t('workplace.welcome') }} {{ username }} {{ t('workplace.happyDay') }}
                </div>
                <div class="mt-10px text-14px text-gray-500">
                  {{ t(currentDate) }}
                </div>
              </div>
            </div>
          </el-col>
          <el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
            <div class="h-70px flex items-center justify-end lt-sm:mt-10px">
              <div class="px-8px text-right">
                <div class="mb-8px text-16px text-gray-400">{{ t('workplace.project') }}</div>
                <CountTo class="text-22px" :start-val="0" :end-val="totalSate.project" :duration="2600" />
              </div>
              <el-divider direction="vertical" />
              <div class="px-8px text-right">
                <div class="mb-8px text-16px text-gray-400">{{ t('workplace.toDo') }}</div>
                <CountTo class="text-22px" :start-val="0" :end-val="totalSate.todo" :duration="2600" />
              </div>
              <!-- <el-divider direction="vertical" border-style="dashed" /> -->
              <!-- <div class="px-8px text-right">
                <div class="mb-16px text-14px text-gray-400">{{ t('workplace.access') }}</div>
                <CountTo
                  class="text-20px"
                  :start-val="0"
                  :end-val="totalSate.access"
                  :duration="2600"
                />
              </div> -->
            </div>
          </el-col>
        </el-row>
      </el-skeleton>
    </el-card>
  </div>
  <el-row class="mt-8px" :gutter="8" justify="space-between">
    <el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-8px">
      <el-card shadow="never">
        <template #header>
          <div class="h-3 flex justify-between">
            <span>{{ t('我的项目') }}</span>
          </div>
        </template>
        <!-- <el-skeleton :loading="loading" animated>
          <el-row>
            <el-col
              v-for="(item, index) in projects"
              :key="`card-${index}`"
              :xl="8"
              :lg="8"
              :md="8"
              :sm="24"
              :xs="24"
            >
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:list" :size="25" class="mr-8px" />
                  <span class="text-16px">{{ item.name }}</span>
                </div>
                <div class="mt-12px flex justify-between text-12px text-gray-400">
                  <span>{{ item.description }}</span>
                  <span>{{ formatTime(item.createTime, 'yyyy-MM-dd') }}</span>
                </div>
              </el-card>
            </el-col>
          </el-row>
        </el-skeleton> -->
        <el-skeleton :loading="loading" animated>
          <el-row>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="goProject">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:document-copy" style="line-height: 26px; color: #1E90FF" class="mr-4px" />
                  <span class="text-16px">项目
                    <span style="color: #1E90FF; font-size: 20px">{{ totalSate.project }}</span>
                    个
                  </span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="onGoingProject">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:document-copy" style="line-height: 26px; color: #FFD700" class="mr-4px" />
                  <span class="text-16px">进行中项目
                    <span style="color: #FFD700; font-size: 20px">{{ runningProjectNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="completedProject">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:document-copy" style="line-height: 26px; color: #32CD32" class="mr-4px" />
                  <span class="text-16px">已完成项目
                    <span style="color: #32CD32; font-size: 20px">{{ finishedProjectNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="overProject">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:document-copy" style="line-height: 26px; color: #FF4500" class="mr-4px" />
                  <span class="text-16px">逾期项目
                    <span style="color: #FF4500; font-size: 20px">{{ overdueProjectNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="goTask">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:film" style="line-height: 26px; color: #1E90FF" class="mr-4px" />
                  <span class="text-16px">任务
                    <span style="color: #1E90FF; font-size: 20px">{{ taskTotal }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="onGoingtask">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:film" style="line-height: 26px; color: #FFD700" class="mr-4px" />
                  <span class="text-16px">进行中任务
                    <span style="color: #FFD700; font-size: 20px">{{ runningTaskNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="completedTask">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:film" style="line-height: 26px; color: #32CD32" class="mr-4px" />
                  <span class="text-16px">已完成任务
                    <span style="color: #32CD32; font-size: 20px">{{ finishedTaskNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
            <el-col :xl="6" :lg="8" :md="8" :sm="24" :xs="24" @click="overTask">
              <el-card shadow="hover" class="mr-5px mt-5px">
                <div class="flex items-center">
                  <Icon icon="ep:film" style="line-height: 26px; color: #FF4500" class="mr-4px" />
                  <span class="text-16px">逾期任务
                    <span style="color: #FF4500; font-size: 20px">{{ overdueTaskNum }}</span>
                    个</span>
                </div>
              </el-card>
            </el-col>
          </el-row>
        </el-skeleton>
      </el-card>
      <el-card shadow="never" class="mt-8px">
        <el-skeleton :loading="loading" animated>
          <el-row :gutter="20" justify="space-between">
            <el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
              <el-card shadow="hover" class="mb-8px">
                <el-skeleton :loading="loading" animated>
                  <Echart :options="pieOptionsData" :height="280" />
                </el-skeleton>
              </el-card>
            </el-col>
            <el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
              <el-card shadow="hover" class="mb-8px">
                <el-skeleton :loading="loading" animated>
                  <Echart :options="barOptionsData" :height="280" />
                </el-skeleton>
              </el-card>
            </el-col>
          </el-row>
        </el-skeleton>
      </el-card>
      <!-- <el-card shadow="never" class="mt-8px">
        <el-skeleton :loading="loading" animated>
          <el-row :gutter="20" justify="space-between">
            <el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
              <el-card shadow="hover" class="mb-8px">
                <el-skeleton :loading="loading" animated>
                  <Echart :options="pieOptionsData" :height="280" />
                </el-skeleton>
              </el-card>
            </el-col>
            <el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
              <el-card shadow="hover" class="mb-8px">
                <el-skeleton :loading="loading" animated>
                  <Echart :options="barOptionsData" :height="280" />
                </el-skeleton>
              </el-card>
            </el-col>
          </el-row>
        </el-skeleton>
      </el-card> -->
    </el-col>
    <el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-8px">
      <el-card shadow="never">
        <template #header>
          <div class="h-3 flex justify-between">
            <span>{{ t('workplace.shortcutOperation') }}</span>
          </div>
        </template>
        <el-skeleton :loading="loading" animated>
          <el-row>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="ep:burger" style="color: #ff69b4; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="projectInfo">项目信息</el-link>
              </div>
            </el-col>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="fa:align-justify" style="color: #8b008b; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="taskInfo">任务信息</el-link>
              </div>
            </el-col>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="fa-solid:book" style="color: #00bfff; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="myFlow">我的流程</el-link>
              </div>
            </el-col>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="fa:slack" style="color: #32CD32; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="todoTask">待办任务</el-link>
              </div>
            </el-col>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="fa:delicious" style="color: #b8860d; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="finishTask">已办任务</el-link>
              </div>
            </el-col>
            <el-col :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon icon="ep:copy-document" style="color: #FFD700; margin-right: 2px" />
                <el-link type="default" :underline="false" @click="toMe">抄送我的</el-link>
              </div>
            </el-col>
            <!-- <el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-8px">
              <div class="flex items-center">
                <Icon :icon="item.icon" class="mr-8px" />
                <el-link type="default" :underline="false" @click="setWatermark(item.name)">
                  {{ item.name }}
                </el-link>
              </div>
            </el-col> -->
          </el-row>
        </el-skeleton>
      </el-card>
      <el-card shadow="never" class="mt-8px">
        <template #header>
          <div class="h-3 flex justify-between" @click="more">
            <span>{{ t('待办任务') }}</span>
            <el-link type="primary" :underline="false">{{ t('更多') }}</el-link>
          </div>
        </template>
        <el-skeleton :loading="loading" animated>
          <div v-for="(item, index) in notice" :key="`dynamics-${index}`">
            <div class="flex items-center" style="margin-bottom: -12.5px">
              <el-avatar :src="avatar" :size="35" class="mr-16px">
                <img src="@/assets/imgs/avatar.gif" alt="" />
              </el-avatar>
              <div>
                <div class="text-14px">
                  <!-- <Highlight :keys="item.keys.map((v) => t(v))"> -->
                  <!-- {{ item.type }} :  -->
                  {{ '发起人：' + item.user }} - {{ '所属流程：' + item.title }}
                  <p style="margin: 0"><el-link @click="handleAudit(item.id)" type="primary" :underline="false">{{
                    t('去办理')
                  }}</el-link></p>
                  <!-- </Highlight> -->
                </div>
                <div class="mt-16px text-12px text-gray-400" style="margin: 0">
                  {{ formatTime(item.date, 'yyyy-MM-dd') }}
                </div>
              </div>
            </div>
            <el-divider />
          </div>
        </el-skeleton>
      </el-card>
    </el-col>
  </el-row>
</template>
<script lang="ts" setup>
import { set } from 'lodash-es'
import { EChartsOption } from 'echarts'
import { formatTime } from '@/utils'
import { useUserStore } from '@/store/modules/user'
import { useWatermark } from '@/hooks/web/useWatermark'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data'

import { ProjectInfoApi, ProjectInfoVO } from '@/api/bpm/projectinfo'
import * as TaskApi from '@/api/bpm/task'
import { ref } from 'vue'


defineOptions({ name: 'Home' })

const { t } = useI18n()
const userStore = useUserStore()
const { setWatermark } = useWatermark()
const loading = ref(true)
const avatar = userStore.getUser.avatar
const username = userStore.getUser.nickname

// 创建一个响应式的日期对象
const currentDate = ref(new Date().toLocaleDateString())

// 获取统计数
let totalSate = reactive<WorkplaceTotal>({
  project: 0,
  access: 0,
  todo: 0
})

// const getCount = async () => {
//   const data = {
//     project: 40,
//     access: 2340,
//     todo: 10
//   }
//   totalSate = Object.assign(totalSate, data)
// }

const router = useRouter() // 路由

// 项目信息
const projectInfo = async () => {
  router.push({
    name: 'BpmProjectInfo'
  })
}

// 任务信息
const taskInfo = async () => {
  router.push({
    name: 'BpmTaskInfo'
  })
}

// 我的流程
const myFlow = async () => {
  router.push({
    name: 'BpmProcessInstanceMy'
  })
}

// 待办任务
const todoTask = async () => {
  router.push({
    name: 'BpmTodoTask'
  })
}

// 已办任务
const finishTask = async () => {
  router.push({
    name: 'BpmDoneTask'
  })
}

// 抄送我的
const toMe = async () => {
  router.push({
    name: 'BpmProcessInstanceCopy'
  })
}

const projectTotal = ref<any>(null) //项目数
const runningProjectNum = ref<any>(null) //进行中项目数
const runningProjectStatus = ref<any>(null) //进行中项目状态
const finishedProjectNum = ref<any>(null) //已完成中项目数
const finishedProjectStatus = ref<any>(null) //已完成项目状态
const overdueProjectNum = ref<any>(null) //逾期项目数
const overdueProjectStatus = ref<any>(null) //逾期项目状态

const taskTotal = ref<any>(null) //任务数
const runningTaskNum = ref<any>(null) //进行中项目数
const runningStatus = ref<any>(null) //进行中项目状态
const finishedTaskNum = ref<any>(null) //已完成中项目数
const finishedStatus = ref<any>(null) //已完成项目状态
const overdueTaskNum = ref<any>(null) //逾期项目数
const overdueStatus = ref<any>(null) //逾期项目状态

// 任务列表
const gatTaskInfo = async () => {
  const data = await ProjectInfoApi.getTaskInfo()
  // 项目
  projectTotal.value = data.projectTotal
  runningProjectNum.value = data.runningProjectNum
  runningProjectStatus.value = data.runningProjectStatus
  finishedProjectNum.value = data.finishedProjectNum
  finishedProjectStatus.value = data.finishedProjectStatus
  overdueProjectNum.value = data.overdueProjectNum
  overdueProjectStatus.value = data.overdueProjectStatus
  // 任务
  taskTotal.value = data.taskTotal
  runningTaskNum.value = data.runningTaskNum
  runningStatus.value = data.runningStatus
  finishedTaskNum.value = data.finishedTaskNum
  finishedStatus.value = data.finishedStatus
  overdueTaskNum.value = data.overdueTaskNum
  overdueStatus.value = data.overdueStatus
}

// 项目
const goProject = async () => {
  router.push({
    name: 'BpmProjectInfo'
  })
}
// 进行中项目
const onGoingProject = async () => {
  router.push({
    name: 'BpmProjectInfo',
    query: { id: runningProjectStatus.value }
  })
}
// 已完成项目
const completedProject = async () => {
  router.push({
    name: 'BpmProjectInfo',
    query: { id: finishedProjectStatus.value }
  })
}
// 逾期项目
const overProject = async () => {
  router.push({
    name: 'BpmProjectInfo',
    query: { id: overdueProjectStatus.value }
  })
}
// 任务
const goTask = async () => {
  router.push({
    name: 'BpmTaskInfo'
  })
}
// 进行中任务
const onGoingtask = async () => {
  router.push({
    name: 'BpmTaskInfo',
    query: { id: runningStatus.value }
  })
}
// 已完成任务
const completedTask = async () => {
  router.push({
    name: 'BpmTaskInfo',
    query: { id: finishedStatus.value }
  })
}
// 逾期任务
const overTask = async () => {
  router.push({
    name: 'BpmTaskInfo',
    query: { id: overdueStatus.value }
  })
}

// 获取项目数
let projects = reactive<Project[]>([])
const getProject = async () => {
  const data = await ProjectInfoApi.getProjectInfoPage({ pageNo: 1, pageSize: 3 })
  // const data = [
  //   {
  //     name: 'ruoyi-vue-pro',
  //     icon: 'akar-icons:github-fill',
  //     message: 'https://github.com/YunaiV/ruoyi-vue-pro',
  //     personal: 'Spring Boot 单体架构',
  //     time: new Date()
  //   },
  //   {
  //     name: 'yudao-ui-admin-vue3',
  //     icon: 'logos:vue',
  //     message: 'https://github.com/yudaocode/yudao-ui-admin-vue3',
  //     personal: 'Vue3 + element-plus',
  //     time: new Date()
  //   },
  //   {
  //     name: 'yudao-ui-admin-vben',
  //     icon: 'logos:vue',
  //     message: 'https://github.com/yudaocode/yudao-ui-admin-vben',
  //     personal: 'Vue3 + vben(antd)',
  //     time: new Date()
  //   },
  //   // {
  //   //   name: 'yudao-cloud',
  //   //   icon: 'akar-icons:github',
  //   //   message: 'https://github.com/YunaiV/yudao-cloud',
  //   //   personal: 'Spring Cloud 微服务架构',
  //   //   time: new Date()
  //   // },
  //   // {
  //   //   name: 'yudao-ui-mall-uniapp',
  //   //   icon: 'logos:vue',
  //   //   message: 'https://github.com/yudaocode/yudao-ui-admin-uniapp',
  //   //   personal: 'Vue3 + uniapp',
  //   //   time: new Date()
  //   // },
  //   // {
  //   //   name: 'yudao-ui-admin-vue2',
  //   //   icon: 'logos:vue',
  //   //   message: 'https://github.com/yudaocode/yudao-ui-admin-vue2',
  //   //   personal: 'Vue2 + element-ui',
  //   //   time: new Date()
  //   // }
  // ]
  projects = Object.assign(projects, data.list)
  totalSate.project = data.total
}

/** 查询任务列表 */
const getList = async () => {
  const data = await TaskApi.getTaskTodoPage({ pageNo: 1, pageSize: 4 })
  totalSate.todo = data.total
  notice = data.list.map((item) => {
    return {
      title: item.processInstance.name,
      date: item.createTime,
      user: item.processInstance.startUser.nickname,
      id: item.processInstance.id
    }
  })
}

/** 更多 */
const more = async () => {
  router.push({
    name: 'BpmTodoTask'
  })
}

/** 办理按钮 */
const { push } = useRouter() // 路由
const handleAudit = (id: any) => {
  push({
    name: 'BpmProcessInstanceDetail',
    query: {
      id: id
    }
  })
}

// 获取通知公告
let notice = reactive<Notice[]>([])
// const getNotice = async () => {
//   const data = [
//     {
//       title: '系统支持 JDK 8/17/21，Vue 2/3',
//       type: '通知',
//       keys: ['通知', '8', '17', '21', '2', '3'],
//       date: new Date()
//     },
//     {
//       title: '后端提供 Spring Boot 2.7/3.2 + Cloud 双架构',
//       type: '公告',
//       keys: ['公告', 'Boot', 'Cloud'],
//       date: new Date()
//     },
//     {
//       title: '全部开源，个人与企业可 100% 直接使用，无需授权',
//       type: '通知',
//       keys: ['通知', '无需授权'],
//       date: new Date()
//     },
//     {
//       title: '国内使用最广泛的快速开发平台，超 300+ 人贡献',
//       type: '公告',
//       keys: ['公告', '最广泛'],
//       date: new Date()
//     }
//   ]
//   notice = Object.assign(notice, data)
// }

// 获取快捷入口
let shortcut = reactive<Shortcut[]>([])

const getShortcut = async () => {
  const data = [
    {
      name: 'Github',
      icon: 'akar-icons:github-fill',
      url: 'github.io'
    },
    {
      name: 'Vue',
      icon: 'logos:vue',
      url: 'vuejs.org'
    },
    {
      name: 'Vite',
      icon: 'vscode-icons:file-type-vite',
      url: 'https://vitejs.dev/'
    },
    {
      name: 'Angular',
      icon: 'logos:angular-icon',
      url: 'github.io'
    },
    {
      name: 'React',
      icon: 'logos:react',
      url: 'github.io'
    },
    {
      name: 'Webpack',
      icon: 'logos:webpack',
      url: 'github.io'
    }
  ]
  shortcut = Object.assign(shortcut, data)
}

// const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
const pieOptionsData = ref({})
// 任务情况
const getUserAccessSource = async () => {
  try {
    const data = await ProjectInfoApi.getTask()
    pieOptionsData.value = {
      title: {
        text: '任务状态分布',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: '任务状态',
          type: 'pie',
          radius: '50%',
          center: ['50%', '60%'],
          data: [
            { value: data.runningTaskNum, name: '进行中任务', itemStyle: { color: '#FFD700' } },
            { value: data.finishedTaskNum, name: '已完成任务', itemStyle: { color: '#32CD32' } },
            {
              value: data.overdueFinishedTaskNum,
              name: '逾期已完成任务',
              itemStyle: { color: '#808080' }
            },
            { value: data.overdueTaskNum, name: '逾期任务', itemStyle: { color: '#FF4500' } },
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    }
  } catch (error) {
    console.error('获取任务数据失败', error)
  }

  // const data = [
  //   { value: 335, name: 'analysis.directAccess' },
  //   { value: 310, name: 'analysis.mailMarketing' },
  //   { value: 234, name: 'analysis.allianceAdvertising' },
  //   { value: 135, name: 'analysis.videoAdvertising' },
  //   { value: 1548, name: 'analysis.searchEngines' }
  // ]
  // set(
  //   pieOptionsData,
  //   'legend.data',
  //   data.map((v) => t(v.name))
  // );

  // pieOptionsData!.series![0].data = data.map((v) => ({
  //   name: t(v.name),
  //   value: v.value
  // }));
}

// const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
const barOptionsData = ref({})
// 项目工时
const getWeeklyUserActivity = async () => {
  try {
    const data = await ProjectInfoApi.getManHour()
    const processedData = data.map((project) => ({
      name: project.projectName,
      value: [
        (project.projectManHour / (1000 * 60 * 60 * 8)).toFixed(1), // 计划工时（天）
        (project.projectActualManHour / (1000 * 60 * 60 * 8)).toFixed(1) // 实际工时（天）
      ]
    }))

    barOptionsData.value = {
      title: {
        text: '项目工时',
        left: 'center'
      },
      tooltip: {
        trigger: 'axis',
        axisPointer: {
          type: 'shadow'
        }
      },
      grid: {
        left: 50,
        right: 20,
        bottom: 20
      },
      xAxis: {
        type: 'category',
        data: processedData.map((item) => item.name),
        axisTick: {
          alignWithLabel: true
        }
      },
      yAxis: {
        type: 'value',
        name: '工时（天）'
      },
      series: [
        {
          name: '计划工时',
          data: processedData.map((item) => item.value[0]),
          type: 'bar'
        },
        {
          name: '实际工时',
          data: processedData.map((item) => item.value[1]),
          type: 'bar'
        }
      ]
    }
  } catch (error) {
    console.error('获取数据失败', error)
  }
  // const data = [
  //   { value: 13253, name: 'analysis.monday' },
  //   { value: 34235, name: 'analysis.tuesday' },
  //   { value: 26321, name: 'analysis.wednesday' },
  //   { value: 12340, name: 'analysis.thursday' },
  //   { value: 24643, name: 'analysis.friday' },
  //   { value: 1322, name: 'analysis.saturday' },
  //   { value: 1324, name: 'analysis.sunday' }
  // ]
  // set(
  //   barOptionsData,
  //   '投入工时',
  //   data.map((v) => t(v.name))
  // )
  // set(barOptionsData, 'series', [
  //   {
  //     name: t('投入工时'),
  //     data: data.map((v) => v.value),
  //     type: 'bar'
  //   }
  // ])
}

const getAllApi = async () => {
  await Promise.all([
    // getCount(),
    // getNotice(),
    getProject(),
    getShortcut(),
    getUserAccessSource(),
    getWeeklyUserActivity(),
    getList(),
    gatTaskInfo()
  ])
  loading.value = false
}
getAllApi()
</script>
